package cn.stylefeng.guns.modular.wms.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.wms.entity.ApplyRead;
import cn.stylefeng.guns.modular.wms.model.params.ApplyReadParam;
import cn.stylefeng.guns.modular.wms.service.ApplyReadService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 已读应聘记录控制器
 *
 * @author yzb
 * @Date 2022-05-05 09:47:55
 */
@Controller
@RequestMapping("/applyRead")
public class ApplyReadController extends BaseController {

    private String PREFIX = "/wms/applyRead";

    @Autowired
    private ApplyReadService applyReadService;

    /**
     * 跳转到主页面
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/applyRead.html";
    }

    /**
     * 新增页面
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/applyRead_add.html";
    }

    /**
     * 编辑页面
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/applyRead_edit.html";
    }

    /**
     * 新增接口
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(ApplyReadParam applyReadParam) {
        this.applyReadService.add(applyReadParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(ApplyReadParam applyReadParam) {
        this.applyReadService.update(applyReadParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(ApplyReadParam applyReadParam) {
        this.applyReadService.delete(applyReadParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(ApplyReadParam applyReadParam) {
        ApplyRead detail = this.applyReadService.getById(applyReadParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author yzb
     * @Date 2022-05-05
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(ApplyReadParam applyReadParam) {
        return this.applyReadService.findPageBySpec(applyReadParam);
    }

}


